# #fit文件解析
# #需要具体描述fit文件中的数据

# import fitparse
# #  解析fit文件
# # Load the FIT file
# fitfile = fitparse.FitFile(r"D:\学习&科研\华为手表项目\华为数据\long_term\fit\1001\1001-Garmin-1-1.fit")

# # Iterate over all messages of type "record"
# # (other types include "device_info", "file_creator", "event", etc)
# for record in fitfile.get_messages("record"):

#     # Records can contain multiple pieces of data (ex: timestamp, latitude, longitude, etc)
#     for data in record:
#         #存入txt文件中
#         with open('fit.txt', 'a') as f:
#         # Print the name and value of the data (and the units if it has any)
#             if data.units:
                
#                 f.write(" *{}: {} ({})".format(data.name, data.value, data.units) + '\n')
#             # print(data)
                
#             else:
                
                
#                     f.write(" *{}: {} (无单位)".format(data.name, data.value) + '\n')
#             # print(data)

#     print("---")
